package edu.spec.lyq.week08.class1.book.unit4.three;

/**
 * \* User: 11028
 * \* Date: 2018/10/18
 * \* Time: 19:55
 * \* Description:
 */
public class Student extends Person{
    String no;
    double scoreOfEn;
    double scoreOfMath;
    double scoreOfCh;
    public Student(String name,char sex, int age,String no, double scoreOfEn,double scoreOfMath,double scoreOfCh){
        super.name = name;
        super.sex = sex;
        super.age = age;
        this.no = no;
        this.scoreOfEn = scoreOfEn;
        this.scoreOfCh = scoreOfCh;
        this.scoreOfMath = scoreOfMath;
    }
    public double aver(){
        return (scoreOfMath + scoreOfCh + scoreOfEn)/3;
    }
    public double max(){
        if(scoreOfEn>scoreOfCh){
            if(scoreOfEn>scoreOfMath){
                return scoreOfEn;
            }else {
                return scoreOfMath;
            }
        }
        else{
            if(scoreOfCh>scoreOfMath){
                return scoreOfCh;
            }else {
                return scoreOfMath;
            }
        }

    }
    public double min(){
        if(scoreOfEn<scoreOfCh){
            if(scoreOfEn<scoreOfMath){
                return scoreOfEn;
            }else {
                return scoreOfMath;
            }
        }
        else{
            if(scoreOfCh<scoreOfMath){
                return scoreOfCh;
            }else {
                return scoreOfMath;
            }
        }

    }
    public String toString(){
        return ("姓名:" + this.name + "\t性别:" + this.sex + "\t年龄:" + this.age + "\t学号:" + this.no + "\t平均分:" + this.aver() + "\t最高分:" + this.max() +"\t最低分:" +  this.min());
    }
}
